#!/usr/bin/python
# -*- coding: UTF-8 -*-
def solution(str):
    l = []
    for i in range(len(str)-4):
        l.append(str[i:i+5])
    return  int(max(l))

print solution("324568753245")
